<%@ Control Language="C#" AutoEventWireup="true" Inherits="Web.Control.WWW.Wiki.FileList" %>
<p><asp:Literal ID="lblInfo" runat="server"/>
<asp:FileUpload ID="updFile" runat="server" size="60" /><br />
<asp:CheckBox ID="chkOverwrite" runat="server" Text="Overwrite existing File" /></p>
<div id="ButtonDiv">
    <asp:Button ID="btnUpload" runat="server" Text="Upload" CssClass="button" OnClick="btnUpload_Click" />
    <asp:Label ID="lblResult" runat="server" />
</div>
<div id="ProgressDiv" style="display: none;"><img src="Images/Wait.gif" alt="Uploading..." /></div>
<br /><br />

<script type="text/javascript">
<!--
    function __PrepareRename(name, type) {
        document.getElementById("<%=txtOldName.ClientID %>").value = name;
        document.getElementById("OldNameSpan").innerHTML = name;
        document.getElementById("<%=txtItemType.ClientID %>").value = type;
        document.getElementById("<%=txtNewName.ClientID %>").value = "";
        document.getElementById("ItemRenameDiv").style["display"] = "";
        document.getElementById("<%=txtNewName.ClientID %>").focus();
        return false;
    }
    function __CancelRename() {
        document.getElementById("<%=txtOldName.ClientID %>").value = "";
        document.getElementById("OldNameSpan").innerHTML = "";
        document.getElementById("<%=txtItemType.ClientID %>").value = "";
        document.getElementById("<%=txtNewName.ClientID %>").value = "";
        document.getElementById("ItemRenameDiv").style["display"] = "none";
        return false;
    }
// -->
</script>

<div id="ItemRenameDiv" style="display: none;">
<h3 class="separator"><asp:Literal ID="lblRename" runat="server" Text="Rename Item"/></h3>
<asp:HiddenField ID="txtItemType" runat="server" />
<asp:HiddenField ID="txtOldName" runat="server"/>
<span id="OldNameSpan"></span><br />
<asp:TextBox ID="txtNewName" runat="server" CssClass="common300"/>
<asp:Button ID="btnRename" runat="server" CssClass="buttong" Text="Rename" OnClick="btnRename_Click" />
<a href="#" onclick="javascript:return __CancelRename();"><asp:Literal ID="lblCancel" runat="server" Text="Cancel"/></a><br />
<small><asp:Literal ID="lblExtension" runat="server" Text="<b>Note</b>: file extension (if needed) is appended automatically."/></small>
<br /><br /><br /><br />
</div>

<asp:Literal ID="lblStrings" runat="server"/>

<asp:Literal ID="lblExpandRename" runat="server"/>

<script type="text/javascript">
<!--

    if(document.getElementById("<%=txtOldName.ClientID %>").value != "")
        document.getElementById("OldNameSpan").innerHTML = document.getElementById("<%=txtOldName.ClientID %>").value;

    function __ConfirmOperation() {
        if(window.confirm(__ConfirmMessage)) return true;
        else return false;
    }
// --> 
</script>

<div class="margin10">
<asp:TextBox ID="txtNewDirectory" runat="server" CssClass="common300" />
<asp:Button ID="btnNewDirectory" runat="server" CssClass="buttong" Text="New Directory" OnClick="btnNewDirectory_Click" />
</div>
<asp:HiddenField ID="txtCurrentDirectory" runat="server" />
<asp:Literal ID="lblFileList" runat="server"/>

<script type="text/javascript">
<!--
   
     document.getElementById("<%=btnUpload.ClientID %>").onclick = __CheckFileExtension;
    
    <% PrintFileExtensions(); %>
    function __CheckFileExtension() {
        var file = document.getElementById("<%=updFile.ClientID %>").value.toLowerCase();
        if(file.length == 0) return true;
        
        var found = 0;
        for(i = 0; i < __ext.length; i++) {
            if(file.substring(file.length - __ext[i].length) == __ext[i]) {
                found = 1;
                break; 
            }
        }
        if(found == 0) {
            window.alert(__message);
            return false;
        }
        
        document.getElementById("ButtonDiv").style["display"] = "none";
        document.getElementById("ProgressDiv").style["display"] = "";
        return true;
    } 
// -->
</script>
<div class="margin10">
<asp:Button ID="btnDeleteSelected" runat="server" CssClass="button" Text="Delete Selected" OnClick="btnDeleteSelected_Click" />&nbsp;&nbsp;<asp:Button ID="btnRefresh" runat="server" CssClass="buttong" Text="Refresh" meta:resourcekey="btnRefreshResource1" />
</div>